package com.ls.socketio.repository;

import com.ls.socketio.bean.RoomBoxInfo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

/**
 * @author liShan
 * @date 2019/9/6 0:21
 */
public interface RoomBoxRepository extends JpaRepository<RoomBoxInfo, Long> {

    /**
     * 根据房间id查询
     * @param roomId 房间id
     * @return 查询结果
     */
    @Query(nativeQuery = true,
            value = "select * from room_box where room_box.room_id = :roomId ORDER BY room_box.createTime LIMIT 1")
    RoomBoxInfo findByRoomId(@Param("roomId") Long roomId);

}
